import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  server: {
    port: 5174,
    host: true, // 允许局域网访问
    open: true, // 自动打开浏览器
    proxy: {
      '/mj': {
        target: 'http://192.168.217.5:8080',
        changeOrigin: true,
        secure: false,
        rewrite: (path) => path.replace(/^\/mj/, '')
      }
    }
  },
})
